﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Test_Drag_N_drop
{
    class HELP
    {

        protected Texture2D _texture;

        protected Rectangle rectangle;
        protected SpriteFont myFont;
        public Rectangle Rect
        {
            get { return rectangle; }
            set { rectangle = value; }
        }

        private bool over = false;



        public Texture2D Texture
        {
            get { return _texture; }
            set { _texture = value; }
        }

        private bool active = false;

        public HELP()
        {
        }

        public void Initialize(int x, int y)
        {
            rectangle = new Rectangle(x, y, 0, 0);
        }

        public virtual void LoadContent(ContentManager content)
        {
        
            _texture = content.Load<Texture2D>("helpwindow");
            rectangle.X = rectangle.X - _texture.Width / 2;
            rectangle.Y = rectangle.Y - _texture.Height / 2;
            rectangle.Width = _texture.Width;
            rectangle.Height = _texture.Height;

        }


        public void Update(GameTime gameTime, MouseState ms, MouseState pms)
        {
            if (active)
            {
                if (rectangle.Contains(ms.X, ms.Y))
                {
                    if (ms.LeftButton == ButtonState.Pressed)
                    {
                        if (pms.LeftButton == ButtonState.Released)
                        {
                            active = false;
                        }
                    }
                }
            }
        }

        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (active)
            {
                spriteBatch.Draw(_texture, rectangle, Color.White);
            }
        }

        public void setActive()
        {
            active = true;
        }

    }
}

